package com.qy139.auth.controller;


import com.qy139.auth.service.ITabMenuService;
import com.qy139.util.Result;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 菜单权限表 前端控制器
 * </p>
 *
 * @author yuhaochen
 * @since 2021-12-01
 */
@RestController
@RequestMapping("/tab-menu")
public class TabMenuController {
    @Resource
    private ITabMenuService tabMenuService;

    //查询当前角色资源
    @PostMapping("/findMenuById")
    public List<String> findMenuById(Integer id){
        return tabMenuService.findMenuNameByUserid(id);
    }

    // 查询所有的菜单
    @GetMapping("/findAllMenu")
    public Result getAllMenu() {
        return new Result(tabMenuService.findAllMenu());
    }

    //查询所有按钮
    @GetMapping("/findAllMenusBtn")
    public Result findAllMenus(){
        return new Result(tabMenuService.findAllMenusBtn());
    }

}

